package com.fh.fruit.service.plantbase.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fh.dao.DaoSupport;
import com.fh.entity.Page;
import com.fh.fruit.entity.plantbase.PlantBase;
import com.fh.fruit.service.plantbase.PlantBaseManager;
import com.fh.util.PageData;

/**
 * 种植基地
 * 
 * @author Administrator
 *
 */
@Service("plantBaseService")
public class PlantBaseService implements PlantBaseManager {
	@Resource(name = "daoSupport")
	private DaoSupport dao;

	@Override
	@SuppressWarnings("unchecked")
	public List<PlantBase> listPlantBases(Page page) throws Exception {
		return (List<PlantBase>) dao.findForList("PlantBaseMapper.plantBaseslistPage", page);
	}

	@Override
	public void savePlantBases(PageData pd) throws Exception {
		dao.save("PlantBaseMapper.savePlantBase", pd);
	}

	@Override
	public int deletePlantBases(PageData pd) throws Exception {
		return (int) dao.delete("PlantBaseMapper.delPlantBases", pd);
	}

	@Override
	public int updatePlantBases(PageData pd) throws Exception {
		return (int) dao.update("PlantBaseMapper.updatePlantBase", pd);
	}

	@Override
	public PlantBase findById(PageData pd) throws Exception {
		return (PlantBase)dao.findForObject("PlantBaseMapper.findById", pd);
	}

	@Override
	@SuppressWarnings("unchecked")
	public List<PageData> findByNameOrCode(PageData pd) throws Exception {
		return (List<PageData>)dao.findForList("PlantBaseMapper.findByNameOrCode", pd);
	}
	@SuppressWarnings("unchecked")
	@Override
	public List<PageData> synTree(int parseInt) throws Exception {
		return (List<PageData>) dao.findForList("PlantBaseMapper.synTree", parseInt);
	}
	@Override
	@SuppressWarnings("unchecked")
	public List<PageData> list(PageData pd) throws Exception {
		return (List<PageData>) dao.findForList("PlantBaseMapper.regionList", pd);
	}

}
